import { request } from '../request';

/* 个人中心文章查询 */
export function creationArticle(
  params: {
    text: string;
    order: string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        category: Api.Category;
        tagInfoList: Api.TagInfo[];
        relativeTime: string;
      } & Api.Article
    >
  >({
    url: '/creation/article',
    method: 'post',
    data: params,
  });
}

export function creationDraft(
  params: {
    text: string;
    order: string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        category: Api.Category;
        tagInfoList: Api.TagInfo[];
        relativeTime: string;
      } & Api.Article
    >
  >({
    url: '/creation/draft',
    method: 'post',
    data: params,
  });
}

export function creationChartDataBar() {
  return request<{
    dataX: Array<string>;
    dataY: Array<number>;
  }>({
    url: '/creation/chart-data-bar',
    method: 'get',
  });
}

export function creationChartDataLine() {
  return request<{
    dataX: Array<string>;
    dataY: Array<number>;
  }>({
    url: '/creation/chart-data-line',
    method: 'get',
  });
}
